package com.stadium.web.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.OrderBy;
import javax.persistence.Table;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

/**
 * 营销活动对象 market_activity
 * 
 * @author ruoyi
 * @date 2020-03-15
 */
@ApiModel("营销活动实体类")
@Table(name="market_activity")
@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
public class MarketActivity implements Serializable
{
    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    /** ID */
    @Column(name = "ID")
    @ApiModelProperty("ID")
    private Long id;

    /** 所属场馆 */
    @Column(name = "VENUE_ID")
    @ApiModelProperty("所属场馆")
    private Long venueId;

    /** 活动名称 */
    @Column(name = "NAME")
    @ApiModelProperty("活动名称")
    private String name;

    /** 优化力度 */

    @Column(name = "DISCOUNT")
    @ApiModelProperty("优化力度")
    private Double discount;

    /** 活动开始时间 */
    @OrderBy("desc")
    @JsonFormat(pattern="yyyy-MM-dd  HH:mm")
        @Column(name = "FROM_TIME")
    @ApiModelProperty("活动开始时间")
    private Date fromTime;

    /** 活动结束时间 */
    @JsonFormat(pattern="yyyy-MM-dd  HH:mm")
        @Column(name = "TO_TIME")
    @ApiModelProperty("活动结束时间")
    private Date toTime;

    @OneToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "VENUE_ID",insertable = false,updatable = false)
    private Venue venue;

    public void setId(Long id) 
    {
        this.id = id;
    }

    public Long getId() 
    {
        return id;
    }
    public void setVenueId(Long venueId) 
    {
        this.venueId = venueId;
    }

    public Long getVenueId() 
    {
        return venueId;
    }
    public void setName(String name) 
    {
        this.name = name;
    }

    public String getName() 
    {
        return name;
    }
    public void setDiscount(Double discount) 
    {
        this.discount = discount;
    }

    public Double getDiscount() 
    {
        return discount;
    }
    public void setFromTime(Date fromTime) 
    {
        this.fromTime = fromTime;
    }

    public Date getFromTime() 
    {
        return fromTime;
    }
    public void setToTime(Date toTime) 
    {
        this.toTime = toTime;
    }

    public Date getToTime() 
    {
        return toTime;
    }

    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("venueId", getVenueId())
            .append("name", getName())
            .append("discount", getDiscount())
            .append("fromTime", getFromTime())
            .append("toTime", getToTime())
            .toString();
    }
}
